[R] How to create a data.frame with a unknow number of columns ?
Posted
by Olivier
on Stack Overflow
See other posts from Stack Overflow
or by Olivier
Published on 2010-04-01T12:53:59Z
Indexed on
2010/04/01
18:23 UTC
Read the original article
Hit count: 255
r
Hello I would like to create, in a function, a boucle to create a data.frame with a variable number of columns.
WIth something like :
a = c("a","b")
b = c(list(1,2,3), list(4,5,6))
data.frame(a,b)
I would like to get a data-frame like :
a 1 2 3
b 4 5 6
Instead of I obtain :
a 1 2 3 4 5 6
b 1 2 3 4 5 6
Thank you !
PS : I also try with rbind, but it's doesn't work...
© Stack Overflow or respective owner